import java.io.BufferedReader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class Result {
	
	

	public static void lectureRs (Connection uneConnection)
	{
		Statement stm;
	
		String requete;
		ResultSet rs;
		

		try
		{
			stm=uneConnection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
			requete= "select * from products";
			rs=stm.executeQuery(requete);
			System.out.println("code produit\tdesignation\tprix unitaire\tstock\tepuise\tDLC");
			while(rs.next())
			{
				System.out.println(rs.getInt("ProductID")+"\t");
				System.out.println(rs.getString("ProductName")+"\t");
				System.out.println(rs.getDouble("UnitPrice")+"\t");
				rs.getShort("UnitsInStock");
				if (rs.wasNull())
				{
					System.out.println("inconnu");
				}else
				{
					System.out.println(rs.getShort("UnitsInStock")+ "\t");
				}
				System.out.println(rs.getBoolean("Discontinued")+ "\t");
				if(rs.getDate("DLC")!=null)
				{
					System.out.println((rs.getDate("DLC")));
				}
				else
					System.out.println("non perissable");
			}
			rs.close();
			
			
		}catch (SQLException e)
		{
			e.printStackTrace();
		}
			
	}

}
